<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        #tab li {
            float: left;
            list-style: none;
            width: 80px;
            height: 40px;
            line-height: 40px;
            cursor: pointer;
            text-align: center;
        }
        
        #container {
            position: relative;
        }
        
        #content1,
        #content2,
        #content3 {
            width: 300px;
            height: 100px;
            padding: 30px;
            position: absolute;
            top: 40px;
            left: 0;
        }
        
        #tab1,
        #content1 {
            background-color: #ffcc00;
        }
        
        #tab2,
        #content2 {
            background-color: #ff00cc;
        }
        
        #tab3,
        #content3 {
            background-color: #00ccff;
        }
    </style>
</head>

<body>
    <h2>多Tab点击切换</h2>
    <ul id="tab">
        <li id="tab1" value="1">a</li>
        <li id="tab2" value="2">b</li>
        <li id="tab3" value="3">c</li>
    </ul>
    <div id="container">
        <div id="content1">
            A的内容
        </div>
        <div id="content2" style="display: none">
            B的内容
        </div>
        <div id="content3" style="display: none">
            C的内容
        </div>
        <input type="checkbox">
        <input type="radio">
    </div>
    <script src="../js/jquery-1.10.1.min.js"></script>
    <script>
        // $("li").click(function() {
        //     let index = $(this).index()
        //     $("#container>div").css("display", "none")
        //         // $("#container>div:eq(" + index + ")").css("display", "block")
        //     $(`#container>div:eq( ${index})`).css("display", "block")
        // })

        //第二种方式：
        // var currIndex = 0;
        // $("#tab>li").click(function() {
        //     var index = $(this).index();
        //     $("#container>div")[currIndex].style.display = "none";
        //     $("#container>div")[index].style.display = "block";
        //     currIndex = index;
        // })


        // 第三种
        $("li").click(function() {
            let index = $(this).index();
            $("#container>div").eq(index).css("display", "block").siblings().css("display", "none")
        })
    </script>
</body>

</html>